home *** CD-ROM | disk | FTP | other *** search
- package java.awt;
-
- import java.awt.event.ComponentEvent;
- import java.awt.event.ComponentListener;
- import java.awt.event.ContainerEvent;
- import java.awt.event.ContainerListener;
- import java.awt.peer.LightweightPeer;
- import java.util.Vector;
-
- final class Component$NativeInLightFixer implements ComponentListener, ContainerListener {
- Vector lightParents;
- Container nativeHost;
- // $FF: synthetic field
- final Component this$0;
-
- Component$NativeInLightFixer(Component var1) {
- this.this$0 = var1;
- this.lightParents = new Vector();
- this.install(var1.parent);
- }
-
- void install(Container var1) {
- this.lightParents.clear();
- Container var2 = var1;
-
- boolean var3;
- for(var3 = true; var2.peer instanceof LightweightPeer; var2 = var2.parent) {
- var2.addComponentListener(this);
- var2.addContainerListener(this);
- this.lightParents.addElement(var2);
- var3 &= var2.isVisible();
- }
-
- this.nativeHost = var2;
- var2.addContainerListener(this);
- this.componentMoved((ComponentEvent)null);
- if (!var3) {
- synchronized(this.this$0.getTreeLock()) {
- if (this.this$0.peer != null) {
- this.this$0.peer.hide();
- }
- }
- }
-
- }
-
- void uninstall() {
- if (this.nativeHost != null) {
- this.removeReferences();
- }
-
- }
-
- public void componentResized(ComponentEvent var1) {
- }
-
- public void componentMoved(ComponentEvent var1) {
- synchronized(this.this$0.getTreeLock()) {
- int var3 = this.this$0.x;
- int var4 = this.this$0.y;
-
- for(Container var5 = this.this$0.parent; var5 != null && var5.peer instanceof LightweightPeer; var5 = var5.parent) {
- var3 += var5.x;
- var4 += var5.y;
- }
-
- if (this.this$0.peer != null) {
- this.this$0.peer.setBounds(var3, var4, this.this$0.width, this.this$0.height, 1);
- }
-
- }
- }
-
- public void componentShown(ComponentEvent var1) {
- if (this.shouldShow()) {
- synchronized(this.this$0.getTreeLock()) {
- if (this.this$0.peer != null) {
- this.this$0.peer.show();
- }
- }
- }
-
- }
-
- private boolean shouldShow() {
- boolean var1 = this.this$0.visible;
-
- for(int var2 = this.lightParents.size() - 1; var2 >= 0 && var1; --var2) {
- var1 &= ((Container)this.lightParents.elementAt(var2)).isVisible();
- }
-
- return var1;
- }
-
- public void componentHidden(ComponentEvent var1) {
- if (this.this$0.visible) {
- synchronized(this.this$0.getTreeLock()) {
- if (this.this$0.peer != null) {
- this.this$0.peer.hide();
- }
- }
- }
-
- }
-
- public void componentAdded(ContainerEvent var1) {
- }
-
- public void componentRemoved(ContainerEvent var1) {
- Component var2 = var1.getChild();
- if (var2 == this.this$0) {
- this.removeReferences();
- } else {
- int var3 = this.lightParents.size();
-
- for(int var4 = 0; var4 < var3; ++var4) {
- Container var5 = (Container)this.lightParents.elementAt(var4);
- if (var5 == var2) {
- this.removeReferences();
- break;
- }
- }
- }
-
- }
-
- void removeReferences() {
- int var1 = this.lightParents.size();
-
- for(int var2 = 0; var2 < var1; ++var2) {
- Container var3 = (Container)this.lightParents.elementAt(var2);
- var3.removeComponentListener(this);
- var3.removeContainerListener(this);
- }
-
- this.nativeHost.removeContainerListener(this);
- this.lightParents.clear();
- this.nativeHost = null;
- }
- }
-